package com.yunxi.controller.vip;

import com.alibaba.dubbo.config.annotation.Reference;
import com.yunxi.core.web.ApiResult;
import com.yunxi.core.web.CurrentUser;
import com.yunxi.core.web.LoginInfo;
import com.yunxi.core.web.ResponseUtil;
import com.yunxi.vip.pojo.VipApplyDetailVO;
import com.yunxi.vip.service.VipApplyDetailDubboService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 
 * @since 2019-09-06
 */
@RestController
@RequestMapping("/admin/vipapplydetail")
@Api(tags = "pms:vipapplydetail", description = "接口")
public class VipApplyDetailController {
 private static final Logger logger = LoggerFactory.getLogger(VipApplyDetailController.class);

 @Autowired
 VipApplyDetailDubboService vipApplyDetailDubboService;

 @GetMapping("/page")
 @ApiOperation(value = "查询分页")
 public ApiResult page(VipApplyDetailVO vipApplyDetailVO, Integer pageNum, Integer pageSize) throws Exception {
  return ResponseUtil.ok(vipApplyDetailDubboService.findPageByVO(vipApplyDetailVO,pageNum,pageSize));
 }

@GetMapping("/list")
   @ApiOperation(value = "查询列表")
   public ApiResult list(VipApplyDetailVO vipApplyDetailVO) throws Exception {
      return ResponseUtil.ok(vipApplyDetailDubboService.listByVo(vipApplyDetailVO));
   }

 @GetMapping("/load")
 @ApiOperation(value = "读取单个")
 public ApiResult load(VipApplyDetailVO vipApplyDetailVO, @CurrentUser LoginInfo loginInfo) throws Exception {
 return ResponseUtil.ok(vipApplyDetailDubboService.getById(vipApplyDetailVO.getDetailId()));
}

 @PostMapping("/save")
 @ApiOperation(value = "保存信息")
 public ApiResult save(@RequestBody VipApplyDetailVO vipApplyDetailVO,@CurrentUser LoginInfo loginInfo) throws Exception {
    vipApplyDetailDubboService.saveOrUpdate(vipApplyDetailVO);
  return ResponseUtil.ok("success");
}

 @PostMapping("/del")
 @ApiOperation(value = "删除")
 public ApiResult del(@RequestBody List<VipApplyDetailVO> vipApplyDetailVOList) throws Exception {
    vipApplyDetailDubboService.removeByListVo(vipApplyDetailVOList);
 return ResponseUtil.ok("success");
 }

/*@PostMapping("/export")
@ApiOperation(value = "导出excel")
public Object export(@RequestParam Map<String,Object> params) throws Exception {
return ResponseUtil.ok(vipApplyDetailDubboService.findMapByList(params));
}*/
}
